<%--
  Created by IntelliJ IDEA.
  User: MECHREVO
  Date: 2021/4/8
  Time: 9:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
    <title>Title</title>
</head>
<link href="${pageContext.request.contextPath}/ui/layui/css/layui.css" rel="stylesheet"/>
<script src="${pageContext.request.contextPath}/ui/layui/layui.js"></script>



<style>
    #da{
        height: 100%;
        width: 100%;
        /*background-color: #F9FAFD;*/
        background-color: #F1F3F4;
    }
    .box{
        text-align:center;
    }

    .layui-form-item{
        margin: 0 auto;
        margin-top: 35px;

    }
    #btn-container{
        margin: 0 auto;
        margin-left: 450px;
        margin-top: -92px;
    }
    #xiangmutype{
        width: 1220px;
        height: 100px;
        margin-left: 330px;
        margin-top: 80px;
        background-color: #FFFFFF;
        border-radius: 10px;
    }
    #span1{
        margin-left: 20px;
        font-size: 15px;
    }
    .label1{
        font-size: 15px;
        margin-left: 18px;
    }
    #projecttype{
        width: 1220px;
        height: 100px;
        margin-left: 28px;
        margin-top: 22px;
    }
    .zhanshi{
        width: 850px;
        height: 141px;
        background-color: #FFFFFF;
        margin-left: 374px;
        margin-top: 20px;
        border-radius: 10px;
    }
    .zhanshi1{
        width: 145px;
        height: 35px;
        /*background-color: #eb7350;*/
        margin-top: -110px;
        margin-left: 175px;
        font-weight:bold;
        font-size: 17px;
    }
    .zhanshi2{
        width: 145px;
        height: 35px;
        /*background-color: #eb7350;*/
        margin-top: 7px;
        margin-left: 175px;
        color: #666666;
    }
    .zhanshi3{
        width: 205px;
        height: 35px;
        /*background-color: #eb7350;*/
        margin-top: 6px;
        margin-left: 175px;
        color: #999999;
        font-weight:bold;
        font-size: 14px;

    }
    .zhanshi4{
        width: 145px;
        height: 35px;
        /*background-color: #eb7350;*/
        margin-top: -35px;
        margin-left: 400px;
    }
    .zhanshi5{
        width: 145px;
        height: 35px;
        /*background-color: #eb7350;*/
        margin-top: -118px;
        margin-left: 666px;
        color: #FF0000;
        font-size: 17px;
        font-weight:bold;
    }
    .zhanshi6{
        width: 145px;
        height: 35px;
        /*background-color: #eb7350;*/
        margin-top: 48px;
        margin-left: 666px;
        color: #999999;
        font-weight:bold;
        font-size: 15px;
    }
</style>

<body>
    <div id="da">
        <div class="box">
            <ul class="layui-nav">
                <li class="layui-nav-item"><a href="">首页</a></li>

                <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/demandhall">需求大厅</a></li>
                <li class="layui-nav-item" style="margin-left: 1532px;">
                    <a href="javascript:;">${userinfo.userName}</a>
                    <dl class="layui-nav-child">
                        <dd><a href="${pageContext.request.contextPath}/updatedanInfo">基本信息</a></dd>
                        <dd><a href="${pageContext.request.contextPath}/anquan">安全管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="${pageContext.request.contextPath}/WEB-INF/jsp/login.jsp">退出</a></li>
            </ul>
            <%--<form method="post" action="${pageContext.request.contextPath}/demandlike">--%>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input type="text" name="demandProjectName" value="${DemandProjectName}" id="demandProjectName" autocomplete="off" placeholder="搜索软件项目" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-btn-container">
                <%--<button type="submit" class="layui-btn">查询项目</button>--%>
                <input type="hidden" value="${pageContext.request.contextPath}" id="contextPath">
                <input type="button" class="layui-btn" id="withExport" value="查询项目">
            </div>
            <%--</form>--%>
            <div class="layui-btn-container" id="btn-container">
                <a href="${pageContext.request.contextPath}/demand"><button type="button" class="layui-btn">发布项目需求</button></a>
            </div>
        </div>
        <div id="xiangmutype">
            <label class="label1" >项目类型</label>
            <div id="projecttype">

            </div>
        </div>
        <div id="zhanshiall">
            <c:forEach items="${demands}" var="demands">
                <div class="zhanshi">
                    <div>
                        <img src="/img/5963d42dd88f4120ada255fd91ac8a6b.jpg" style="width: 110px; height: 110px; margin-left: 14px; margin-top: 14px;">
                    </div>
                    <a href="${pageContext.request.contextPath}/demanddan?demandId=${demands.demandId}">
                    <div class="zhanshi1">
                        <span style="text-align: center">${demands.demandProjectName}</span>
                    </div>
                    </a>
                    <div class="zhanshi2">
                        <span style="text-align: center">项目</span>
                    </div>
                    <div class="zhanshi3">
                        <span style="text-align: center">${demands.technicalName}</span>
                    </div>
                    <div class="zhanshi4">
                        <span style="text-align: center">参加&nbsp&nbsp&nbsp人</span>
                    </div>
                    <div class="zhanshi5">
                        <span style="text-align: center">￥${demands.budgetAmount}</span>
                    </div>
                    <div class="zhanshi6">
                            <span style="text-align: center">${demands.createTime}</span>

                    </div>
                </div>
            </c:forEach>

        </div>

    </div>
</body>
<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>

<script type="text/javascript">

    $(document).ready(function(){
        layui.use('form',function (){
            var form=layui.form;
            $.ajax({

                type:"post",
                url:"${pageContext.request.contextPath}/projecttypequan",
                dataType:"json",
                async:true,
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    var element='';
                    for(var i=0;i<data.length;i++){

                        element+="<a href='${pageContext.request.contextPath}/demandprojecttype?prohectTypeId="+data[i].projectTypeId+"'><span id='span1'>" + data[i].prohectTypeName + "</span></a>";

                        console.log(element);
                        /*<span id=\"span1\" name=\"prohectTypeName\">" + data[i].prohectTypeName + "</span>*/
                        /*<input type=\"button\" class=\"layui-btn\" id=\"prohectTypeId\" value='"+data[i].prohectTypeName+"'>*/

                    }

                    $("#projecttype").html(element);
                    form.render('select');
                },
                error:function(data,errrorMessage,e){
                    alert("服务器异常，请重试");
                }
            });

        });

    });

    /*$(document).ready(function(){
        layui.use('form',function (){
            var form=layui.form;
            $.ajax({

                type:"post",
                url:"${pageContext.request.contextPath}/demandquan",
                dataType:"json",
                async:true,
                contentType:"application/json;charset=utf-8",
                success:function(data){
                    var element='';
                    for(var i=0;i<data.length;i++){
                        /!*element+="<input type='checkbox' name='like1[read]'  value='" + data[i].projectTypeId + "'>"+data[i].prohectTypeName;*!/
                        element+="<div class=\"zhanshi\">\n" +
                            "                <div>\n" +
                            "                    <img src=\"/img/5963d42dd88f4120ada255fd91ac8a6b.jpg\" style=\"width: 110px; height: 110px; margin-left: 14px; margin-top: 14px;\">\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi1\">\n" +
                            "                    <span style=\"text-align: center\">"+data[i].demandProjectName+"</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi2\">\n" +
                            "                    <span style=\"text-align: center\">项目</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi3\">\n" +
                            "                    <span style=\"text-align: center\">技能要求:"+data[i].technicalName+"</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi4\">\n" +
                            "                    <span style=\"text-align: center\">参加&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp人</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi5\">\n" +
                            "                    <span style=\"text-align: center\">￥"+data[i].budgetAmount+"</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi6\">\n" +
                            "                    <span style=\"text-align: center\">"+data[i].createTime+"</span>\n" +

                            "                </div>\n" +
                            "            </div>"

                        console.log(element);
                    }

                    $("#zhanshiall").html(element);
                    form.render('select');
                },
                error:function(data,errrorMessage,e){
                    alert("服务器异常，请重试");
                }
            });

        });

    });*/

    layui.use('form',function () {
        var form = layui.form;
        $("#withExport").click(function () {
            layer.msg("弹框");
            alert($(this).val())
            alert("点击")
            var demandProjectName = $("#demandProjectName").val();
            alert(demandProjectName);
            var url = $("#contextPath").val() + "/demandlike";

            $.ajax({
                type: "post",
                url: url,
                data:JSON.stringify({
                    "demandProjectName":demandProjectName
                }),
                dataType: "json",
                async: true,
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    var element = '';
                    for (var i = 0; i < data.length; i++) {
                        element += "<div class=\"zhanshi\">\n" +
                            "                <div>\n" +
                            "                    <img src=\"/img/5963d42dd88f4120ada255fd91ac8a6b.jpg\" style=\"width: 110px; height: 110px; margin-left: 14px; margin-top: 14px;\">\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi1\">\n" +
                            "                    <span style=\"text-align: center\">" + data[i].demandProjectName + "</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi2\">\n" +
                            "                    <span style=\"text-align: center\">项目</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi3\">\n" +
                            "                    <span style=\"text-align: center\">技能要求:" + data[i].technicalName + "</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi4\">\n" +
                            "                    <span style=\"text-align: center\">参加&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp人</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi5\">\n" +
                            "                    <span style=\"text-align: center\">￥" + data[i].budgetAmount + "</span>\n" +
                            "                </div>\n" +
                            "                <div class=\"zhanshi6\">\n" +
                            "                    <span style=\"text-align: center\">" + data[i].createTime + "</span>\n" +

                            "                </div>\n" +
                            "            </div>"
                    }

                    $("#zhanshiall").html(element);
                    /*$("#homecities").html(element);*/
                    form.render('select');
                },

            });
            console.log("success")

        });
    })





</script>
</html>
